<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">业务归属</label>
                        <div class="layui-input-block">
                            <div id="gui_unit" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="gofuer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
<!--                                <div id="search_open" onclick="toggle_search()">-->
<!--                                    <i class="layui-icon layui-icon-down"></i>展开-->
<!--                                </div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>




    var currButAuth, currTabData;
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });


        setSouTableExport('工程费用收取汇总');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_engin_feishouhui_list),where: {}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {
                currButAuth = res.data.butauth;
                tableButShow(currButAuth);

                xmselect_dan('gui_unit', res.data.gui_unit, res.data.is_gui_unit, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                ,{field:'name',title:'工程名称',templet: function(d){
                        return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                    }}
                ,{field: 'gui_unit_name', title: '业务归属'}
                ,{field: 'gofuer', title: '工程负责人'}
                ,{field:'',title:'施工合同金额(元)',totalRow: true,templet: function(d){
                    if(d.shiinfo){
                        return '<span class="colorlan" onclick="openPage(\'../contract_shi/show.php?id='+d.shiinfo.id+'\');">'+parseFormatNum(d.shiinfo.money)+'</span>';
                    }else{
                        return '';
                    }
                }}
                ,{field:'shijiemoney',title:'施工合同结算金额(元)',totalRow: true,templet: function(d){
                    if(d.shijiemoney){
                        return '<span class="colorlan" onclick="openNavPage(\'施工合同结算信息\',\'contract_shi_jie/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.shijiemoney)+'</span>';
                    }else{
                        return '';
                    }
                }}
                ,{field:'ratefu',title:'劳务分包服务费率(%)',templet: function(d){
                        if(d.ratefu){
                            return '<span class="colorlan" onclick="openNavPage(\'工程管理文件汇编信息\',\'contract_nei/index.php?status=1&enginid='+d.id+'\');">'+d.ratefu+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'rateshui',title:'税款保证金费率(%)',templet: function(d){
                        if(d.rateshui){
                            return '<span class="colorlan" onclick="openNavPage(\'工程管理文件汇编信息\',\'contract_nei/index.php?status=1&enginid='+d.id+'\');">'+d.rateshui+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'yingkoufee',title:'服务费应收金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.yingkoufee)}}
                ,{field:'yikoufee',title:'服务费收取金额(元)',totalRow: true,templet: function(d){
                        if(d.yikoufee){
                            return '<span class="colorlan" onclick="openNavPage(\'扣收服务费明细信息\',\'hou_chi_kou_fuwu/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.yikoufee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'daikoufee',title:'服务费待收金额(元)',totalRow: true,templet: function(d){
                        if(d.daikoufee > 0){
                            return '<span class="colorhong">'+parseFormatNum(d.daikoufee)+'</span>';
                        }else{
                            return d.daikoufee;
                        }
                    }}
                ,{field:'shuiyingfee',title:'税款应收金额(元)',totalRow: true,templet: function(d){
                        if(d.shuiyingfee){
                            return '<span class="colorlan" onclick="openNavPage(\'工程销项票开具信息\',\'piao_kai/index.php?status=1&enginid='+d.id+'\');">'+parseFormatNum(d.shuiyingfee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'shuiyifee',title:'税款收取金额-承诺书(元)',totalRow: true,templet: function(d){
                        if(d.shuiyifee){
                            return '<span class="colorlan" onclick="openNavPage(\'扣收税款明细信息\',\'hou_chi_kou_shuifei/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.shuiyifee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'shuiyizhifee',title:'税款收取金额-直接收取(元)',totalRow: true,templet: function(d){
                        if(d.shuiyizhifee){
                            return '<span class="colorlan" onclick="openNavPage(\'直接扣收明细信息\',\'hou_chi_kou_qifei/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.shuiyizhifee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'waifee',title:'外管税缴纳金额(元)',totalRow: true,templet: function(d){
                        if(d.waifee){
                            return '<span class="colorlan" onclick="openNavPage(\'销项票开具信息\',\'piao_kai/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.waifee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'shuidaifee',title:'税款待收金额(元)',totalRow: true,templet: function(d){
                        if(d.shuidaifee > 0){
                            return '<span class="colorhong">'+parseFormatNum(d.shuidaifee)+'</span>';
                        }else{
                            return d.shuidaifee;
                        }
                    }}
                ,{field:'qiyifee',title:'其他费收取金额(元)',totalRow: true,templet: function(d){
                        if(d.qiyifee){
                            return '<span class="colorlan" onclick="openNavPage(\'直接扣收明细信息\',\'hou_chi_kou_qifei/index.php?enginid='+d.id+'\');">'+parseFormatNum(d.qiyifee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'shouallfee',title:'收取金额合计(元)',totalRow: true,templet: function(d){return parseFormatNum(d.shouallfee)}}
                ,{field:'daiallfee',title:'待收合计(元)',totalRow: true,templet: function(d){
                        if(d.daiallfee > 0){
                            return '<span class="colorhong">'+parseFormatNum(d.daiallfee)+'</span>';
                        }else{
                            return d.daiallfee;
                        }
                    }}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });


        listTableSearch(form, table);
    });


</script>
</body>
</html>
